package com.pignest.hotel.ui.room;

import org.zkoss.zul.Menuitem;

import com.pignest.hotel.beans.Room;
import com.pignest.hotel.definition.RoomRepairStatus;
import com.pignest.hotel.definition.RoomUseStatus;
import com.pignest.hotel.system.Logic;

public class RoomStatusContextMenu extends RoomContextMenu {

	private static final long serialVersionUID = -4061379469765426952L;

	@Override
	protected void onOpen(RoomView rv) {
		super.onOpen(rv);
		Room room = rv.getRoom();
		((Menuitem)getFellow("menuUseStatusCheck")).setDisabled(!Logic.canChangeStatus(room, RoomUseStatus.CHECKING));
		((Menuitem)getFellow("menuUseStatusClean")).setDisabled(!Logic.canChangeStatus(room, RoomUseStatus.CLEAN));
		((Menuitem)getFellow("menuUseStatusDirty")).setDisabled(!Logic.canChangeStatus(room, RoomUseStatus.DIRTY));
		((Menuitem)getFellow("menuRepairStatusRepair")).setDisabled(!Logic.canChangeStatus(room, RoomRepairStatus.REPAIR));
		((Menuitem)getFellow("menuRepairStatusNormal")).setDisabled(!Logic.canChangeStatus(room, RoomRepairStatus.NORMAL));
	}
}
